<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<script>
/*
矩阵
1234       1
1234       2
1234   *   3
1234       4

1*1+2*2+3*3+4*4
1*1+2*2+3*3+4*4
1*1+2*2+3*3+4*4
1*1+2*2+3*3+4*4

*/

var arr1=[[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4]]
var arr2=[1,2,3,4]
function rect(arr1,arr2){
	var newarr=[];
	for(var i=0;i<arr1.length;i++){
		var result=0;
		for(var j=0;j<arr2.length;j++){
			result+=arr1[i][j]*arr2[j];	
		};	
		newarr.push(result)
			
	};	
	return newarr;
}
alert(rect(arr1,arr2))

</script>
</body>
</html>
